import { defineStore } from "pinia";
import { EStore } from "@/enum";
import type { IGlobalStoreState } from "@/types";

const store = defineStore(EStore.GLOBAL_STORE, {
  state: (): IGlobalStoreState => ({
    count: 0,
    keepAliveHome: false
  }),
  getters: {
    BsCount: (state) => (bs: number) => state.count * bs,
  },
  actions: {
    setCount(_count: number) {
      this.count = _count;
    },
    setKeepAliveHome(type: boolean){
      this.keepAliveHome = type;
    }
  },
});

export default store;
